<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="ui.xhtml">

	<ui:define name="head">
		<style type="text/css">
.ui-confirm-dialog-severity {
	margin: 0 7px 7px 0;
}
</style>
	</ui:define>
	<ui:define name="content">
		<p:panel header="#{msg.link_profile}" id="panel">
			<!-- Formulario para el boton de nuevo -->
			<h:form>
				<p:commandButton value="#{msg.label_newprofile}" onclick="dlgNew.show()"
					icon="add" />
			</h:form>
			<br />
			<!-- Formulario para el dialogo de nuevo perfil -->
			<h:form id="frmNew">
				<p:dialog header="#{msg.label_newprofile}" widgetVar="dlgNew" resizable="false"
					modal="true" id="newProfileDialog">
					<p:growl id="newGlow" showDetail="false" sticky="true" />
					<h:panelGrid columns="2" style="margin-bottom:10px">
						<h:outputLabel for="descripcion" value="#{msg.label_description}:" />
						<p:inputText id="descripcion" value="#{ProfileBean.descripcion}" />
					</h:panelGrid>
					<p:commandButton id="submitButton" value="#{msg.label_save}" icon="save"
						actionListener="#{ProfileBean.saveProfile()}"
						oncomplete="dlgNew.hide();"
						update=":frmProfile,newGlow,newProfileDialog" />
					<p:commandButton value="#{msg.label_cancel}" oncomplete="dlgNew.hide();"
						icon="cancel" />
				</p:dialog>
			</h:form>
			<!-- Formulario para la table de perfiles -->
			<h:form id="frmProfile">
				<p:dataTable var="profile" value="#{ProfileBean.listProfile}"
					paginator="true" rows="10" paginatorPosition="bottom"
					paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="1,5,10,15,20,30">
					<h:inputHidden value="#{profile.id}" />
					<p:column headerText="#{msg.label_description}">
						<h:outputText value="#{profile.profile}" />
					</p:column>
					<p:column style="width:12%; text-align: center;">
						<p:commandButton oncomplete="descDialog.show()" icon="edit"
							title="#{msg.label_edit}" update=":frmDesc:descDialog"
							actionListener="#{ProfileBean.prepareProfile(profile.id)}" />
						<p:commandButton icon="delete" title="#{msg.label_edit}"
							onclick="confirmation.show()"
							actionListener="#{ProfileBean.prepareProfile(profile.id)}" />
						<p:commandButton oncomplete="rolDialog.show()" icon="roles"
							title="#{msg.label_roles}" update=":frmRoles:rolDialog"
							actionListener="#{ProfileBean.prepareProfile(profile.id)}" />
					</p:column>
				</p:dataTable>
			</h:form>
			<!-- Formulario para editar la descripcion de perfil -->
			<h:form id="frmDesc">
				<p:dialog header="#{msg.label_description}" widgetVar="descDialog"
					resizable="false" modal="true" id="descDialog">
					<p:growl id="descGrowl" showDetail="false" sticky="true" />
					<h:panelGrid columns="2" style="margin-bottom:10px">
						<h:outputLabel for="descripcion" value="#{msg.label_description}:" />
						<p:inputText id="descripcion"
							value="#{ProfileBean.profile.profile}" />
					</h:panelGrid>
					<p:commandButton value="#{msg.label_save}" icon="save"
						oncomplete="descDialog.hide();" update=":frmProfile,descGrowl"
						actionListener="#{ProfileBean.editProfile()}" />
					<p:commandButton value="#{msg.label_cancel}" oncomplete="descDialog.hide();"
						icon="cancel" />
				</p:dialog>
			</h:form>
			<!-- Formulario para borrar perfil -->
			<h:form prependId="false">
				<p:growl id="deleteGlow" />
				<p:confirmDialog id="confirmDialog"
					message="#{msg.label_confirmationdltprofile}" header="#{msg.label_dltprofile}"
					severity="alert" widgetVar="confirmation">
					<p:commandButton id="confirm" update=":frmProfile,deleteGlow"
						value="#{msg.label_yes}" oncomplete="confirmation.hide()"
						actionListener="#{ProfileBean.delete()}" icon="accept" />
					<p:commandButton id="decline" value="#{msg.label_no}"
						onclick="confirmation.hide()" type="button" icon="cancel" />
				</p:confirmDialog>
			</h:form>
			<!-- Formulario para editar los roles del perfil -->
			<h:form id="frmRoles">
				<p:dialog header="#{msg.label_administratorrolesprofile}"
					widgetVar="rolDialog" resizable="false" modal="true" id="rolDialog"
					width="400">
					<p:growl id="growl" showDetail="false" sticky="true" />
					<h:outputText value="#{ProfileBean.profile.profile}"
						style="font-weight:bold" />
					<br />
					<p:selectBooleanCheckbox value="#{ProfileBean.profile.addDir}" />
					<h:outputText value="#{msg.label_createdir}" />
					<br />
					<p:selectBooleanCheckbox value="#{ProfileBean.profile.editDir}" />
					<h:outputText value="#{msg.label_modifydir}" />
					<br />
					<p:selectBooleanCheckbox value="#{ProfileBean.profile.deleteDir}" />
					<h:outputText value="#{msg.label_dltdir}" />
					<br />
					<p:selectBooleanCheckbox value="#{ProfileBean.profile.fileLoad}" />
					<h:outputText value="#{msg.label_loadfile}" />
					<br />
					<p:selectBooleanCheckbox value="#{ProfileBean.profile.findFile}" />
					<h:outputText value="#{msg.label_findfile}" />
					<br />
					<p:selectBooleanCheckbox value="#{ProfileBean.profile.deleteFile}" />
					<h:outputText value="#{msg.label_dltfile}" />
					<br />
					<p:selectBooleanCheckbox value="#{ProfileBean.profile.renameFile}" />
					<h:outputText value="#{msg.label_renamefile}" />
					<br />
					<p:selectBooleanCheckbox
						value="#{ProfileBean.profile.addProperties}" />
					<h:outputText value="#{msg.label_addprop}" />
					<br />
					<p:selectBooleanCheckbox
						value="#{ProfileBean.profile.editProperties}" />
					<h:outputText value="#{msg.label_modifyprop}" />
					<br />
					<p:selectBooleanCheckbox value="#{ProfileBean.profile.sendEmail}" />
					<h:outputText value="#{msg.label_sendmail}" />
					<br />
					<p:selectBooleanCheckbox value="#{ProfileBean.profile.reciveEmail}" />
					<h:outputText value="#{msg.label_recievemail}" />
					<br />
					<p:selectBooleanCheckbox value="#{ProfileBean.profile.copy}" />
					<h:outputText value="#{msg.label_copy}" />
					<br />
					<p:selectBooleanCheckbox value="#{ProfileBean.profile.paste}" />
					<h:outputText value="#{msg.label_paste}" />
					<br />
					<p:selectBooleanCheckbox value="#{ProfileBean.profile.checkout}" />
					<h:outputText value="#{msg.label_checkout}" />
					<br />
					<p:selectBooleanCheckbox value="#{ProfileBean.profile.checkin}" />
					<h:outputText value="#{msg.label_checkin}" />
					<p:separator />
					<p:commandButton value="#{msg.label_save}" icon="save"
						oncomplete="rolDialog.hide();" update="growl"
						actionListener="#{ProfileBean.editProfile()}" />
					<p:commandButton value="#{msg.label_cancel}" oncomplete="rolDialog.hide();"
						icon="cancel" />
				</p:dialog>
			</h:form>
		</p:panel>
		<p:confirmDialog header="Oooops!!!" severity="alert"
			visible="#{not empty param['expired']}" message="View has expired."
			widgetVar="confirmDlg">
			<p:commandButton type="button" value="OK" onclick="confirmDlg.hide()" />
		</p:confirmDialog>
	</ui:define>
</ui:composition>